#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

void Remove(int* arr, int n, int m)
{
	for (int i = 0; i < n; i++)
	{
		if (arr[i] == m)
		{
			for (i; i < n; i++)
			{
				arr[i] = arr[i + 1];
			}
			Remove(arr, n - 1, m);
		}
	}
}

int main()
{
	int arr[50] = { 0 }, n, m;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}
	scanf("%d", &m);
	Remove(arr, n, m);
	for (int i = 0; i < n; i++)
	{
		if (arr[i] != 0)
			printf("%d ", arr[i]);
	}
	return 0;
}